<template>
  <router-view v-if="isRouterAlive"></router-view>
</template>

<script>
import { provide, nextTick } from 'vue'
import { ElMessage } from 'element-plus'
export default {
  setup() {
    let isRouterAlive = true
    const reload = () => {
      isRouterAlive = false
      nextTick(() => {
        isRouterAlive = true
        ElMessage({
          message: '刷新成功',
          type: 'success',
          duration: 2000
        })
      })
    }
    provide('reload', reload)
    return {
      isRouterAlive
    }
  }
}
</script>

<style lang="scss">
html,
body {
  padding: 0;
  margin: 0;
  height: 100%;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100%;
  /* 解决移动端手指点击或滑动屏幕时出现的浅蓝色背景框 */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
</style>
